home *** CD-ROM | disk | FTP | other *** search
- /**
- -- File: GX Scrolling (main).h
- --
- -- Comments: This header file contains the prototypes, constants, and type definitions
- -- used by "GX Scrolling (main).c" file.
- --
- -- Version: 1.0 1/93
- -- => added general GX support & scrolling
- --
- --
- -- Components: GX Scrolling (main).c
- -- GX Scrolling (main).h
- -- GX Scrolling Controls.c
- -- GX Scrolling Controls.h
- -- GX Scrolling (main).π.rsrc
- --
- --
- -- Notes: 1) Print this file in landscape for the best results
- -- 2) If you are using THINK C v5.x, I have added markers to navigate the
- -- code.
- -- 3) This code was adapted and simplyified from the "DTS AE Skeleton" sample.
- --
- -- Author: Pete "Luke" Alexander
- -- Developer Technical Support
- -- AppleLink: DEVSUPPORT
- --
- --
- -- ©1992 - 1993 Apple Computer, Inc.
- --
- **/
-
- #include <Menus.h>
- #include <OSEvents.h>
- #include <Quickdraw.h>
- #include <Windows.h>
-
- #include "graphics types.h"
- #include "PrintingManager.h"
-
- /***** Type Definitions *****/
- typedef struct MyWindowRecord /* Tack storage onto the end of the WindowRecord */
- {
- WindowRecord window;
- PicHandle picture; /* PICT to display in window */
- Rect documentBoundsRect;
- Point origin; /* location of upper left corner of picture in window (local) */
- ControlHandle hScrollBar; /* Handle to horizontal scroll bar */
- ControlHandle vScrollBar; /* Handle to vertical scroll bar */
- } MyWindowRecord, *MyWindowPeek;
-
-
- /***** Constants *****/
- enum
- {
- kDriverType = 'DRVR', /* Resource Types */
- kPictureType = 'PICT',
-
- kScrollBarWidth = 16, /* Constants */
- kMinWindowWidth = 100,
- kMinWindowHeight = 75,
- kTitleBarHeight = 19,
- kNewWindowOffset = 1+kTitleBarHeight,
- kMinimumDocumentSize = 64,
-
- rMenuBar = 1000, /* Menu bar */
-
- mApple = 1000, /* Menus */
- iAbout = 1,
-
- mFile = 1001,
- iNew = 1,
- iOpen = 2,
- iClose = 3,
- iSave = 5,
- iSaveAs = 6,
- iPrintOneCopy = 8,
- iDocumentSetup = 9,
- iPageSetup = 10,
- iPrint = 11,
- iQuit = 13,
-
- mEdit = 1002,
- iUndo = 1,
- iCut = 3,
- iCopy = 4,
- iPaste = 5,
- iClear = 6,
- iSelectAll = 8,
-
- rAboutBox = 1000, /* Alerts */
- rFatalErrorAlert = 1001,
- rNonFatalErrorAlert = 1002,
-
- rErrorStrings = 1000, /* Errors */
- kNoQDGXErr = 1,
- kNoQDGXPrintingErr = 2,
- kNoAppleEventsErr = 3,
- kNoMenuBarErr = 4,
- kOutOfMemoryErr = 5,
- kCanNotOpenFile = 6,
- kBadPictFile = 8,
- kPrintingErr = 9,
- kAppleEventErr = 10,
- kAppleEventInitErr = 11,
- kGotOAPP = 12,
- kGotODOC = 13,
- kGotPDOC = 14,
- kGotQUIT = 15,
-
- rDocumentWindow = 1000 /* Windows */
- };
-
-
- //
- // Prototypes
- //
- void HandleEvent(void);
- void HandleMouseDown(EventRecord *theEvent);
- void HandleKeyPress(EventRecord *theEvent);
- void HandleDiskEvent(EventRecord *theEvent);
- void HandleOSEvent(EventRecord *theEvent);
-
- void DoGrowWindow(WindowPtr theWindow, Point where);
- void DoZoomWindow(WindowPtr theWindow, short thePart);
- void ActivateWindow(WindowPtr theWindow, Boolean activate);
- void FitWindowOnDevice(Rect *windRect, Rect *deviceRect);
- Rect GetDeviceRect(WindowPtr theWindow);
-
- void DoMenu(long menuChoice);
-
- Boolean CreateDocumentWindow(PicHandle thePicture, Str63 name);
- void CloseFrontWindow(void);
- void DrawWindow(WindowPtr theWindow);
- void AdjustMenus(void);
-
- void ToolBoxInit(void);
- void MenuBarInit(void);
- Boolean ColorQDAvail(void);
- void ErrorAlert(short errNumber, Boolean fatal);
- void ShutdownProgram(void);
-
-
- //
- // The following functions were added to support GX, create the text and layout shapes,
- // support GX printing, and add scrolling window support.
- //
- void QuickDrawGXInit (void);
- Boolean QuickDrawGXInstalled (void);
-
- gxShape CreateThePageOfGXShapes (gxShape thePage);
- gxShape CreateTextShape (gxShape thePage);
- gxShape CreateLayoutShape (gxShape thePage);
-
-
- gxJob PrintInit (void);
- void DoPrintOneCopy (WindowPtr window, gxJob documentJob, gxShape thePage);
- void DoDocumentSetupCommand (gxJob documentJob);
- void DoPrintCommand (WindowPtr window, gxJob documentJob, gxShape thePage);
- void TermintatePrintLand (gxJob documentJob);
-
- void TranslateWindowBounds(WindowPtr myWindow, gxRectangle *boundingBoxPtr);
- void ResetContentViewPortClip (WindowPtr theWindow);
-
-
-